<extend name="layout/application"/>
<block name="css">
    <link rel="stylesheet" href="/vendor/markdown/css/editormd.min.css"/>
</block>
<block name="content">
    <div class="admin-content">
        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">新增课程</strong> /
                <small>Create Course</small>
            </div>
        </div>
        <div class="am-g">
            <div class="am-u-sm-12 am-u-md-12">
                <form class="am-form" action="{{:Url('Courses/save')}}" method="post">
                    <div class="am-tabs am-margin" data-am-tabs>
                        <ul class="am-tabs-nav am-nav am-nav-tabs">
                            <li class="am-active"><a href="#tab1">通用信息</a></li>
                            <li><a href="#tab2">课程标签</a></li>
                            <li><a href="#tab3">课程描叙</a></li>
                        </ul>

                        <div class="am-tabs-bd">
                            <div class="am-tab-panel am-fade am-in am-active" id="tab1">
                                <div class="am-g am-margin-top">
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        课程名称
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4">
                                        <input type="text" class="am-input-sm" name="name">
                                    </div>
                                    <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                                </div>

                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        单价
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                        <input type="text" class="am-input-sm" name="price">
                                    </div>
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        略缩图
                                    </div>

                                    <div class="am-u-sm-8 am-u-md-8 am-u-end col-end">
                                        <div class="am-form-group am-form-file new_thumb">
                                            <button type="button" class="am-btn am-btn-success am-btn-sm">
                                                <i class="am-icon-cloud-upload" id="loading"></i> 上传新的缩略图
                                            </button>
                                            <input type="file" id="image_upload">
                                            <input type="hidden" name="photo_id">
                                        </div>

                                        <hr data-am-widget="divider" style="" class="am-divider am-divider-dashed"/>

                                        <div>
                                            <img src="" id="img_show" style="max-height: 200px;">
                                        </div>
                                    </div>
                                </div>
                                <div class="am-g am-margin-top sort">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        适合人群
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                        <input type="text" class="am-input-sm" name="target">
                                        <br>
                                        <textarea rows="4" name="target_body"></textarea>
                                    </div>
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        推荐
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                        <label class="am-radio-inline">
                                            <input type="radio" value="1" name="best" checked> 是
                                        </label>
                                        <label class="am-radio-inline">
                                            <input type="radio" value="0" name="best"> 否
                                        </label>
                                    </div>
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        发布
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                        <label class="am-radio-inline">
                                            <input type="radio" value="1" name="publish" checked> 是
                                        </label>
                                        <label class="am-radio-inline">
                                            <input type="radio" value="0" name="publish"> 否
                                        </label>
                                    </div>
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        更新
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                        <label class="am-radio-inline">
                                            <input type="radio" value="0" name="complete" checked> 是
                                        </label>
                                        <label class="am-radio-inline">
                                            <input type="radio" value="1" name="complete"> 否
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="am-tab-panel am-fade" id="tab2">
                                <div class="am-g am-margin-top">
                                    <table class="am-table ">
                                        <foreach $taglists as $taglist>
                                            <tr>
                                                <td class="am-text-right"><span
                                                        class="am-badge am-badge-secondary  am-round am-text-default">{{$taglist.name}}</span>
                                                </td>

                                                <td>
                                                    <foreach $taglist.tags as $tag>
                                                        <input type="checkbox" name="tag_id[]" value="{{$tag.id}}">
                                                        <span class="am-badge am-badge-success am-radius">{{$tag.name}}</span>
                                                    </foreach>
                                                </td>

                                            </tr>
                                        </foreach>
                                    </table>
                                </div>
                            </div>

                            <div class="am-tab-panel am-fade" id="tab3">
                                <div class="am-g am-margin-top-sm">
                                    <div class="am-u-sm-12 am-u-md-12">
                                        <div id="markdown">
                                            <textarea rows="10" name="body" style="display:none;"></textarea>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>

                        <div class="am-margin">
                            <button type="submit" class="am-btn am-btn-primary am-radius">提交保存</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</block>
<block name="js">
    //html 5上传图片
    <script src="/vendor/admin/html5-fileupload/jquery.html5-fileupload.js"></script>
    <script src="/vendor/admin/js/upload.js"></script>
    //markdown
    <script src="/vendor/markdown/editormd.min.js"></script>
    <script src="/vendor/admin/js/editormd_config.js"></script>
</block>